<div>
	{{if count($CurrentUser['role_id'])>1}}
	<div>
		<p><a href="javascript:void(0)" onclick="if(confirm('是否确认要清空草稿箱中所有草稿')) ajaxAction('/drafts/clear/WxMsg',null,null,function(){$('.draft-item').remove();publishController.close_dialog();});"  class="btn btn-sm btn-warning"><i class="fa fa-remove"></i> 清空草稿箱 </a></p>
	</div>
	{{/if}}
    <?PHP foreach($drafts as $item) {
				//$item = $item[$modelClass];
    		?>	
    	<div id="draft-{{$item['Draft']['id']}}" class="draft-item" data-id="{{$item['Draft']['id']}}"  style="border:1px solid #eee;position:relative;margin-bottom:10px;padding:10px;">
			<div class="draft-popover" data-container="#draft-{{$item['Draft']['id']}}" data-content="{{htmlspecialchars($item['Draft']['content'])}}" title="{{$item['Draft']['updated']}} 草稿预览">
			
				<p><strong>{{$item['Draft']['updated']}}</strong></p>
				{{if $item['Draft']['name']}} <h3>{{$item['Draft']['name']}}</h3> {{/if}}
				<p>{{mb_substr(trim(strip_tags($item['Draft']['content'])),0,100)}}</p>
				<p>
					{{if $_REQUEST['type']=='old'}}
					<a href="javascript:void(0)" onclick="use_draft({{$item['Draft']['id']}},'old');" class="btn btn-sm btn-primary"><i class="fa fa-edit"></i> 打开使用</a>
					{{else}}
					<a href="javascript:void(0)" onclick="use_draft({{$item['Draft']['id']}},'new');" class="btn btn-sm btn-primary"><i class="fa fa-edit"></i> 打开使用</a>
					{{/if}}
					<a href="javascript:void(0)" onclick="if(confirm('是否确认删除')) ajaxAction('/drafts/delete/{{$item['Draft']['id']}}?type={{$_REQUEST['type']}}',null,null,function(){$('#draft-{{$item['Draft']['id']}}').remove();});"  class="btn btn-sm btn-default"><i class="fa fa-remove"></i> 删除</a>
				</p>
			</div>
		</div>		
	<?php } ?>
</div>
<!-- {{if empty($_REQUEST['type'])}}
<p>草稿数据维护中，如需加载9月8日前的草稿数据，请点下方更早草稿的按钮</p>
<p><a class="btn btn-default" href="/drafts/lists?type=old">更早草稿</a></p>
<p><br/></p>
{{/if}} -->
<div class="alert alert-info">云端草稿<span style="color:red;">仅对付费VIP用户开放</span>，每五分钟自动保存一次草稿。保存上限为50篇,可结合文章历史版本搭配查找以往数据。</div>

<div class="text-center"><a class="btn btn-primary" href="javascript:void(0)" data-dismiss="modal">关闭</a></div>
